"""
MIL (Multiple Instance Learning) 训练配置
"""

import os

# ----------------------------------------------------------------------------
# --- 1. 路径配置 (Path Configuration) ---
# ----------------------------------------------------------------------------

# --- 内部交叉验证 (CV) 数据 ---
# split_file_path = "/data0/lcy/Patho-Bench/tools/zzylnm_slices_splits/cohort.tsv" # k=10
# split_file_path = "/data0/lcy/Patho-Bench/tools/zzylnm_slices_splits/cohort_onlynfy.tsv"
# split_file_path = "/data0/lcy/Patho-Bench/tools/zzylnm_slices_splits/cohort_r3.tsv"
# split_file_path = "/data0/lcy/Patho-Bench/tools/zzylnm_slices_splits/k=all.tsv"
# split_file_path = "/data0/lcy/Patho-Bench/tools/zzylnm_slices_splits2/cohort.tsv"
# split_file_path = "/data0/lcy/Patho-Bench/tools/zzylnm_slices_splits2/cohort_f1.tsv"
# split_file_path = "/data0/lcy/Patho-Bench/tools/zzylnm_crcpro_splits/cohort.tsv"
split_file_path = "/data0/lcy/Patho-Bench/tools/zzylnm_crcpro_splits2/cohort.tsv"
# split_file_path = "/data0/lcy/Patho-Bench/tools/zzylnm_slices_splits3/cohort.tsv"


# feats_path = "/data0/lcy/data/LNM/LNM_slices_conch_v1_processed/20x_512px_0px_overlap/features_conch_v1"
# feats_path = "/data0/lcy/data/LNM/LNM_slices_uni_v1_processed/10x_512px_0px_overlap/features_uni_v1"
# feats_path = "/data0/lcy/data/LNM/LNM_slices_uni_v1_processed/10x_512px_0px_overlap/features_uni_v2"
# feats_path = "/data0/lcy/data/LNM/LNM_CRCpro_uni_v1_processed/10x_512px_0px_overlap/features_uni_v1"
feats_path = "/data0/lcy/data/LNM/LNM_CRCpro_uni_v1_processed/10x_512px_0px_overlap/features_uni_v2"


# 交换数据集
# feats_path = "/data0/lcy/data/LNM/LNM_Zhujiang_uni_v1_processed/10x_512px_0px_overlap/features_uni_v1"
# split_file_path = "/data0/lcy/Patho-Bench/tools/zzylnm_zhujiang_splits/cohort.tsv"

# --- 外部测试 (External Test) 数据 ---
# 交换数据集
external_manifest_path = (
    "/data0/lcy/Patho-Bench/tools/zzylnm_zhujiang_splits/cohort.tsv"
    # "/data0/lcy/Patho-Bench/tools/zzylnm_slices_splits2/cohort_r1.tsv"
    # "/data0/lcy/Patho-Bench/tools/zzylnm_slices_splits2/cohort.tsv"
    # 前瞻性
    # "/data0/lcy/Patho-Bench/tools/zzylnm_crcpro_splits2/cohort.tsv"
)

# external_feats_path = "/data0/lcy/data/LNM/LNM_Zhujiang_uni_v1_processed/10x_512px_0px_overlap/features_uni_v1"
external_feats_path = "/data0/lcy/data/LNM/LNM_Zhujiang_uni_v1_processed/10x_512px_0px_overlap/features_uni_v2"
# external_feats_path = "/data0/lcy/data/LNM/LNM_Zhujiang_uni_v1_processed/10x_512px_0px_overlap/features_uni_v1"
# external_feats_path = "/data0/lcy/data/LNM/LNM_slices_uni_v1_processed/10x_512px_0px_overlap/features_uni_v1"
# external_feats_path = "/data0/lcy/data/LNM/LNM_CRCpro_uni_v1_processed/10x_512px_0px_overlap/features_uni_v1"


# ----------------------------------------------------------------------------
# --- 2. 模型与训练配置 (Model & Training Configuration) ---
# ----------------------------------------------------------------------------
feature_dim = 1536  # 特征维度 (例如 1024 for UNI)
task_label_col = "label"  # 标签列名
# fold_columns = [
#     "fold_0",
#     "fold_1",
#     "fold_2",
#     "fold_3",
#     "fold_4",
#     "fold_5",
#     "fold_6",
#     "fold_7",
#     "fold_8",
#     "fold_9",
# ]  # CV 折数
instance_loss_weight = 0.7
clam_k = 8
fold_columns = [
    "fold_0",
    "fold_1",
    "fold_2",
    "fold_3",
    "fold_4",
]  # CV 5折数
save_dir = "saved_models"  # 模型保存目录


# --- 训练超参数 ---
SEED = 3407
# 注意: num_epochs = 1 将无法观察到过拟合。
# 建议增加 (例如 20) 来使用 "每个 epoch 验证" 功能。
num_epochs = 20
batch_size = 64
learning_rate = 5e-4 #  1e-4
train_patches_sampled = 256  # 训练时采样的 patch 数量

# --- 选择要运行的模型 ---
model_types_to_run = [
    # "abmil",
    # "dsmil",
    # "transmil",
    # "linearprobe",
    # "maemil",
    "MAEMILModel_CLSToken",
    # "hybrid_mil", # 似乎在原始代码中被注释掉了，按需添加
    # "CLAMModel",
    # "TransMIL_CLSToken",
    # "TransMIL_GatedAttention"
]
